import { createStore, combineReducers, applyMiddleware } from 'redux'

import reducers from './reducers'
import thunk from 'redux-thunk'
import { h0 } from '../../common/fp'
import { ORDER_DEPART } from '../constant'

export default createStore(
  combineReducers(reducers),
  {
    from: null,
    to: null,
    departDate: h0(),
    highSpeed: false, // 只看高铁动车
    trainList: [],
    orderType: ORDER_DEPART, // 排序类型
    onlyTickets: false, // 只看有票
    ticketTypes: [], // 坐席类型
    checkedTicketTypes: {},
    trainTypes: [], // 车次类型
    checkedTrainTypes: {},
    departStations: [], // 出发车站
    checkedDepartStations: {},
    arriveStations: [], // 到达车站
    checkedArriveStations: {},
    departTimeStart: 0, // 出发时间起始
    departTimeEnd: 24,
    arriveTimeStart: 0, // 到达时间开始
    arriveTimeEnd: 24,
    isFiltersVisible: false,
    searchParsed: false,
  },
  applyMiddleware(thunk)
)
